package PackageScore;

import java.util.Random;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {


        School.setScoreLine(400);
        Random random = new Random();
        Student[] studentArr = new Student[10];
        studentArr[0] = new Student("theFirst", "001", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[1] = new Student("theSecond", "002", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[2] = new Student("theThird", "003", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[3] = new Student("theForth", "004", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[4] = new Student("theFifth", "005", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[5] = new Student("theSixth", "006", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[6] = new Student("theSeventh", "007", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[7] = new Student("theEighth", "008", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[8] = new Student("theNinth", "009", random.nextDouble(200, 800), random.nextDouble(100));
        studentArr[9] = new Student("theTenth", "010", random.nextDouble(200, 800), random.nextDouble(100));

        double total = 0;
        double avarage = 0;
        int num = 0;
        for (Student student : studentArr) {
            if (new Admission().luQu(student)) {
                System.out.println(student.getName() + " is eligible for admission");
                total += student.getIntgretResult();
                num++;
                avarage = total / num;
            }
        }
        System.out.println("the average result is " + avarage);

        System.out.println("Please enter the id of the student:");
        Scanner sc = new Scanner(System.in);
        new Admission().search(sc.next(), studentArr);
    }

}
